import logging
from appium.webdriver.common.mobileby import MobileBy
from base.base_page import BasePage
from pages.edit_member_page import EditMemberPage


class AddMemberPage(BasePage):
    _manually_locator = (MobileBy.XPATH, "//*[@text='手动输入添加']")
    _toast_locator = (MobileBy.XPATH, "//*[@class='android.widget.Toast']")

    def add_manually(self):
        logging.info("调用add_manually方法")
        self.find_and_click(self._manually_locator)
        return EditMemberPage(self.driver)

    def get_message(self):
        logging.info("调用get_message方法")
        return self.get_element_text(self._toast_locator)